package br.jonasLab.financistoweb.view.managed;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import br.jonasLab.financistoweb.control.CategoryControl;
import br.jonasLab.financistoweb.model.Category;

@ManagedBean
@SessionScoped
public class CategoryMB extends MB<Category> {

	private CategoryControl control;
	
	public CategoryMB(){
		super();
		control = new CategoryControl();
	}
	
	@Override
	protected void initializeEntity() {
		setEntity(new Category());
	}
	
	public void testeBotao(){
		try {
			List<Category> categories = control.findAll();
			for (int i = 0; i < categories.size(); i++) {
				System.out.println(categories.get(i).getTitle());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
